<?php
session_start();
include("functions.php");

$message= "Sorry Bub you cant get in!";

//check for boggies
if(!isset($_SESSION['SESS_ADMIN_ID'])){
echo $message;
    header("Refresh: 1; URL=login.php");
}

//TODO
//list all the chats!
//delete chats
//check status
//join chats
?>
<html>
    <head>
        <title>Welcome to The Admin Panel</title>
    </head>
    <body>
        <h1>Welcome to the Admin Panel</h1>
        <span>Your access Level is <?php echo $_SESSION['access']; ?></span>
        <span><a href="logout.php">Logout</a></span>
        <h3>Chat List</h3>
        <form method="post" action="joinChat.php">
            <select name="chat">
            <?php
                getChatList();
            ?>
            </select>
         <input type="hidden" name="user" value="<?php echo $_SESSION['SESS_ADMIN_ID'];?>" />
         <input type="submit" value="Join Chat" />
        </form>
        <br /><br />
 <h3>Add New User</h3>
<form method="post" action="insertAdmin.php">
    Username: <input type="text" name="username"><br/>
    Password: <input type="password" name="password" ><br/>
    First Name: <input type="text" name="firstname"><br/>
    Last Name: <input type="text" name="lastname"><br/>
    Email: <input type="text" name="email" ><br/>
    Access: <input type="text" name="access"> (0 or 1)<br/><br/>
    <input type="submit" value="submit" >
</form>

</body>
</html>